﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ZhouYu.DreamTour.Web.Attributes
{
    public class MyFirstHomeAttribute : ActionFilterAttribute
    {
        // https://www.jb51.net/article/107353.htm
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var context = filterContext.HttpContext;
            context.Session["IsStaticHtml"] = false;
            string path = context.Server.MapPath("/Resource/Manage/Html/Home/Index.html");
            if (System.IO.File.Exists(path))
            {
                string html = System.IO.File.ReadAllText(path);
                context.Response.Write(html);
                context.Session["IsStaticHtml"] = true;
                context.Response.End();
            }
        }
    }
}